package com.alpha.framework.utils;

import android.content.Context;
import android.content.SharedPreferences;

public class SharedPreferencesUtils {

	public static final String SP_NAME = "config";
	public static final String FIRST_START_APP="first_start_app";
	
	private static SharedPreferences sp;

	private static Context mContext=UIUtils.getContext();
	
	public static void saveboolean(String key, boolean value) {
		if (sp == null)
			sp = mContext.getSharedPreferences(SP_NAME, 0);
		sp.edit().putBoolean(key, value).commit();
	}

	public static boolean getboolean(String key, boolean defValue) {
		if (sp == null)
			sp = mContext.getSharedPreferences(SP_NAME, 0);
		return sp.getBoolean(key, defValue);
	}
	
	
	public static void saveString(String key, String value) {
		if (sp == null)
			sp = mContext.getSharedPreferences(SP_NAME, 0);
		sp.edit().putString(key, value).commit();
	}
	
	public static String getString(String key, String defValue) {
		if (sp == null)
			sp = mContext.getSharedPreferences(SP_NAME, 0);
		return sp.getString(key, defValue);
	}

}
